package com.lwz.repair.sendredpackage;

import java.util.ArrayList;

public class Menage extends User{
    public Menage() {
    }

    public Menage(String name, int monkny) {
        super(name, monkny);

    }
    public ArrayList<Integer> Send(int totalleftmonky,int count){
        ArrayList<Integer> redlist=new ArrayList<>();

        int leftmonky = super.getMonkny();
        if (leftmonky<totalleftmonky){
            System.out.println("余额不足");
            return redlist;
        }
        super.setMonkny(leftmonky-totalleftmonky);
        int avg =totalleftmonky/count;
        int mod =totalleftmonky % count;
        for (int i = 0; i < count-1; i++) {
            redlist.add(avg);
        }
        int last =avg+mod;
        redlist.add(last);

        return redlist;

    }

}
